<?php
class Flexigrid extends Controller {

	function Flexigrid  ()
	{
		parent::Controller();	
		$this->load->helper('flexigrid');
		$this->config->load('flexigrid');
	}
	
	function index()
	{

		$data['extraHeadContent'] = "<link href=\"".base_url()."public/css/style.css\" rel=\"stylesheet\" type=\"text/css\" \n/>";
		$data['extraHeadContent'] .= "<link href=\"".base_url()."public/css/flexigrid.css\" rel=\"stylesheet\" type=\"text/css\" \n/>";
		$data['extraHeadContent'] .= "<script type=\"text/javascript\" src=\"".base_url()."public/js/jquery.pack.js\"></script> \n";
		$data['extraHeadContent'] .= "<script type=\"text/javascript\" src=\"".base_url()."public/js/flexigrid.pack.js\"></script>\n";
		$data['page_title'] = $this->lang->line('menu_root_system');

		//ver lib
		
		/*
		 * 0 - display name
		 * 1 - width
		 * 2 - sortable
		 * 3 - align
		 * 4 - searchable (2 -> yes and default, 1 -> yes, 0 -> no.)
		 */
		$colModel['id'] = array('ID',40,TRUE,'center',2);
		$colModel['iso'] = array('ISO',40,TRUE,'center',0);
		$colModel['name'] = array('Name',180,TRUE,'left',1);
		$colModel['printable_name'] = array('Printable Name',120,TRUE,'left',0);
		$colModel['iso3'] = array('ISO3',130, TRUE,'left',0,TRUE);
		$colModel['numcode'] = array('Number Code',80, TRUE, 'right',1);
		$colModel['actions'] = array('Actions',80, FALSE, 'right',0);
		
		/*
		 * 0 - display name
		 * 1 - bclass
		 * 2 - onpress
		 */
		$buttons[] = array('Add','add','test');
		$buttons[] = array('Delete','delete','test');
		$buttons[] = array('separator');
		$buttons[] = array('Select All','add','test');
		$buttons[] = array('DeSelect All','delete','test');
		$buttons[] = array('separator');
		
		//Build js
		//View helpers/flexigrid_helper.php for more information about the params on this function
		$grid_js = build_grid_js('flex1','ajax/',$colModel,$buttons,'id','asc','auto','400',$this->config->item('fg_per_page'));
		
		$data['js_grid'] = $grid_js;




		$this->load->view('flexigrid',$data, false, 'flexigrid');
		
	}
}
?>
